System.SerialPort Method

Gets the specified serial port on the user's machine. Specify the serial port either by its index or by path.

Syntax

System.SerialPort Index

System.SerialPort Path

Parameters

Index

Integer

Path

String

Notes

On Mac OS X and Linux, the path is the path to the device file corresponding to the serial device (e.g., /dev/ttyS0). On Windows, this can be the COM port you want to open, e.g.,

Serial1.SerialPort=System.SerialPort("COM1")